<?php namespace Home\Controller; 

use Hdphp\Controller\Controller;

//测试控制器
class CarteController extends Controller{
	        
		public function index(){
			$data=Cart::getAllData(); 
           //分配到模板
//         p($data);
            View::with('data',$data);
		    View::make();
	}
			
	/**
	 * 添加购物车请求地址
	 */		
	public function ajaxAddCart(){
			$data = array(
				'id'    	=> Q('post.id',0,'intval'),
				'name'  	=> Q('post.name',''),
				'num'	 	=> Q('post.num',0,'intval'),				
				'price' 	=> Q('post.price',0,'intval'),
				'options'   =>array(
								'color'	  => Q('post.color',''),
								'size'    => Q('post.size',''),							
							    ),
		        );
		
		
		Cart::add($data);
//		p($_SESSION); 	
		 
     }
	
	
    public function del(){
      //删除session
		session_unset();
      //摧毁session
		session_destroy();
		
		View::ajax(1);
    }
    
	
	
		
}